package com.fingard.generalobj;

import java.io.UnsupportedEncodingException;

public class NoticeReq {
	
	/**请求的字节*/
	public byte[] reqBytes;
	
	/**请求的字符集*/
	public String reqCharset;
	
	public int contentStartIndex;
	
	public int contentLength;
	
	/**获取请求的内容，contentStartIndex之后的，即不包含通讯头部
	 * @throws UnsupportedEncodingException */
	public String getReqString() throws UnsupportedEncodingException{
		String tmpStrReq = "";

            if (contentStartIndex >= 0 && contentLength > 0) {
                tmpStrReq = new String(reqBytes, contentStartIndex, contentLength, reqCharset);
            }else{
            	tmpStrReq = new String(reqBytes, 0, reqBytes.length, reqCharset);
            }
       
		return tmpStrReq;
	}
	
	/**取得请求的全部字符，包含头部
	 * @throws UnsupportedEncodingException */
	public String getFullString() throws UnsupportedEncodingException{
		return new String(reqBytes, contentStartIndex, contentLength, reqCharset);	
	}
}
